<?php
$msg= 'xxca22[T3]asda';
preg_match('/\[T([0-9]*)\]/', $msg, $matches);
var_dump($matches);
exit;

$arr =['pj1'=>'a','pj2'=>'b','pj3'=>'c','pj4'=>'d','pj5'=>'e'];
$rnum=mt_rand(1,5);
echo $arr['pj'.$rnum];